﻿using Xejen.Logger;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;

namespace Xejen.Communication.Configuration
{
    /// <summary>
    /// 表示通讯配置
    /// </summary>
    /// <creator>marc</creator>
    public class CommunicationConfig<THeartbeatConfig>
        where THeartbeatConfig : HeartbeatConfig, new()
    {
        /// <summary>
        /// 通讯器是否可用，默认：true
        /// </summary>
        public bool Enable { get; set; } = true;

        /// <summary>
        /// 请求的超时时间，单位：毫秒，默认值：4000
        /// </summary>
        public int Timeout { get; set; } = 4000;

        /// <inheritdoc cref="Xejen.Communication.Configuration.HeartbeatConfig" path="/summary"/>
        public THeartbeatConfig HeartbeatConfig { get; set; } = new THeartbeatConfig();

        /// <summary>
        /// 序列化设置
        /// </summary>
        [System.Text.Json.Serialization.JsonIgnore]
        [Newtonsoft.Json.JsonIgnore]
        public JsonSerializerOptions JsonSerializerOptions { get; set; } = CommunicationSerializerOptions.Normalize;

        /// <inheritdoc cref="Xejen.Logger.LogVerbosity"/>
        public LogVerbosity LogVerbosity { get; set; } = LogVerbosity.Normal;

        /// <inheritdoc cref="CommunicationConfig{THeartbeatConfig}"/>
        public CommunicationConfig() { }
    }
}
